		<div class="easyui-layout" data-options="fit:true">
			<div data-options="region:'west',split: true" style="width:20%">
		    	<div style="padding: 5px;">
					<ul id="zTreeTypeSettings" class="ztree"></ul>
				</div>
		    </div>
		  
						<div id="table_div"  data-options="region:'center',border: false" >
							<table id="table_typeSettings"  style="height:100%;" data-options="
								cls:'theme-datagrid',
								toolbar: '#tb_type',
								singleSelect: true,
								rownumbers: true, //显示序号
								pagination: true,
								pageSize: 10,
								collapsible: true
							" >
							
							</table>
							
							<div id="tb_type" style="height:30px">
								<a id="aadd" href='#' onclick='add()' style="float: left;" class='easyui-linkbutton' plain='true'><span class='l-btn-left l-btn-icon-left' style='padding:0 0 0 0'><span class='l-btn-text' >添加产品</span><span class='l-btn-icon icon-add' style='margin-top:-7px'>&nbsp;</span></span></a>
<!-- 								<a id="asave" href='#' style="width:81px" class='easyui-linkbutton' plain='true'><span class='l-btn-left l-btn-icon-left' style='padding:0 0 0 0'><span class='l-btn-text' >保存</span><span class='l-btn-icon icon-save' >&nbsp;</span></span></a> -->
							</div>
					 </div>
		  </div>
		<div id="dlg_addProducy" class="easyui-dialog" title="添加产品" style="width:60%;height:70%;padding:10px;" closed="true"
            data-options="
                iconCls: 'icon-save',
                cls:'theme-panel-orange',
                buttons: [{
                    text:'ok',
                    cls:'theme-panel-orange',
                    iconCls:'icon-ok',
                    handler:function(){
                        addpro();
                    }
                
                }]
            ">
            	<% include("/typeClassSettings/addProduct.html"){} %>
    	</div>
		<script type="text/javascript">
			var setting = {
					async: {
						enable : true,
						url : '${cxt! }/typeClassSettings/treeData',
						autoParam : ["id=ids"],//, "level=lv"
						//otherParam : {"otherParam" : "zTreeAsyncTest"},
						type : "post"
					},

				view: {
					fontCss: getFont,
					expandSpeed: "",
					addHoverDom: addHoverDom,
					removeHoverDom: removeHoverDom,
					selectedMulti: false,
					dblClickExpand: false
				},
				edit: {
					enable: true,
					removeTitle: "删除部门",
					renameTitle: "编辑部门名称"
					//showRemoveBtn: false
				},
				data: {
					simpleData: {
						enable: true
					}
				},
				callback: {
					onClick: zTreeOnClick,
					beforeRemove: beforeRemove, //节点被删除之前的事件,并且根据返回值确定是否允许删除操作
					beforeRename: beforeRename, //用于捕获节点编辑名称结束

					beforeAsync: beforeAsync, //用于捕获异步加载之前的事件回调函数,zTree 根据返回值确定是否允许进行异步加载
					onAsyncSuccess: onAsyncSuccess, //用于捕获异步加载出现异常错误的事件回调函数
					onAsyncError: onAsyncError, //用于捕获异步加载正常结束的事件回调函数
					beforeExpand: beforeExpand,
					beforeDrag: beforeDrag, //用于捕获节点被拖拽之前的事件回调函数，并且根据返回值确定是否允许开启拖拽操作
					beforeDrop: beforeDrop, //用于捕获节点拖拽操作结束之前的事件回调函数，并且根据返回值确定是否允许此拖拽操作
					beforeDragOpen: beforeDragOpen, //用于捕获拖拽节点移动到折叠状态的父节点后，即将自动展开该父节点之前的事件回调函数，并且根据返回值确定是否允许自动展开操作
					onDrag: onDrag, //用于捕获节点被拖拽的事件回调函数
					onDrop: onDrop, //用于捕获节点拖拽操作结束的事件回调函数
					onExpand: onExpand //用于捕获节点被展开的事件回调函数
				}
			};
			
			
			
				
			
			function zTreeOnClick(event, treeId, treeNode) {
				$("#table_div" ).css("display", "none"); 
					
					var parentName=treeNode.getParentNode().name;
					if(parentName=="产品类别")
					{
						var columns = [[
										{field:'productname',title:'产品名称',width:80,align:'center'},
										{field:'producttype',title:'产品类别',width:100,align:'center'},
										{field:'productspecification',title:'产品规格',width:100,align:'center'},
										{field:'productunits',title:'产品单位',width:100,align:'center'},
										{field:'productcapacity',title:'产品容量',width:100,align:'center'},
										{field:'productexperience',title:'产品类使用经验值',width:100,align:'center'},
										{field:'productstatus',title:'状态',width:100,align:'center',formatter:probutton},
								    ]];
									$("#table_div" ).css("display", "block"); 
									$("#asave" ).css("display", "none");
									$.ajax({
									   url: "${cxt !}/typeClassSettings/getProByType",
									   type: "post",
									    data:{"ids":treeNode.id}, 
									    dataType:"json",
									    success: function (re) {
									    	var a=JSON.stringify(re);
									    	$("#table_typeSettings").datagrid({title:treeNode.name,columns:columns});
									        $("#table_typeSettings").datagrid("loadData",re.splitPage.list);  //动态取数据
									        
									    }
								 });
					}
					if(treeNode.name=="存货计价方式")
					{
						var columns = [[
										{field:'ck',width:80,align:'center',checkbox:'true'},
										{field:'chjjfs',title:'存货计价方式',width:200,align:'center'},
										{field:'statis',title:'状态',width:120,align:'center'}
								    ]];
						data = [ /**自定义的数据源，ztree支持json,数组，xml等格式的**/
									{"chjjfs":"先进先出法","statis":"正常"},
									{"chjjfs":"移动加权平均价","statis":"正常"},
									{"chjjfs":"月末一次加权平均价","statis":"正常"},
									{"chjjfs":"个别认定法","statis":"正常"}
								];
						$("#table_div" ).css("display", "block"); 
						$("#asave" ).css("display", "none");
						$("#table_typeSettings").datagrid({title:treeNode.name,columns:columns,data:data});
// 					    $("#table_typeSettings").datagrid("loadData",re.splitPage.list);  //动态取数据
							        			
									
					}
					if(treeNode.name=="支付方式")
					{
						data = [ /**自定义的数据源，ztree支持json,数组，xml等格式的**/
									{"jzmb":"3个7","statis":"正常"},
									{"jzmb":"3个10","statis":"正常"},
								];
								var columns = [[
									{field:'ck',width:80,align:'center',checkbox:'true'},
									{field:'jzmb',title:'减重目标',width:200,align:'center'},
									{field:'statis',title:'状态',width:120,align:'center'}
							    ]];
						$("#table_div" ).css("display", "block"); 
						$("#asave" ).css("display", "none");
						$("#table_typeSettings").datagrid({title:treeNode.name,columns:columns,data:data});
// 					    $("#table_typeSettings").datagrid("loadData",re.splitPage.list);  //动态取数据
							        			
									
					}
			};
			function probutton(value,row,index){
				if(value==1)
				{	
					return "<a href='#' title='点击禁用该产品' class='button-delete button-success  l-btn l-btn-small'  onclick='quitPro("+index+")' group='' id=''><span class='l-btn-left'><span class='l-btn-text'>正常</span></span></a>";
				}else
				{	
					return "<a href='#' class='button-delete button-danger  l-btn l-btn-small'   group='' id=''><span class='l-btn-left'><span class='l-btn-text'>禁用</span></span></a>";
				}
				
			}
			function  quitPro(index)
			{
				var rows = $('#table_typeSettings').datagrid('getRows');
				var row = rows[index];
				var ids = row.ids;
				var typeids=row.typeids;
				if(confirm("确认禁用该产品吗？")) 
				{
					//更新数据库用户状态1-0
					var url = "/typeClassSettings/updateProductStatus";
					var data = { "ids": ids};
					var reData = common_ajax.ajaxFunc(url, data);
// 					var  daJson=JSON.parse(reData).data;
					var  stJson=JSON.parse(reData).status; 
					if(stJson=="success" )
					{
						$.ajax({
							   url: "${cxt !}/typeClassSettings/getProByType",
							   type: "post",
							   async : false, 
							    data:{"ids":typeids}, 
							    dataType: "json",
							    success: function (re) {
							        $("#table_typeSettings").datagrid("loadData",re.splitPage.list);  //动态取数据
							    }
						}); 
					}
				}
			}
			function  add()
			{
				var  proType=$("#table_typeSettings").datagrid('getPanel').panel('options').title;
				$("#dlg_addProducy").dialog("open");
				$("#proType").textbox("setValue", proType);
			}
			
			function 	addpro()
			{		
				var treeObj = $.fn.zTree.getZTreeObj("zTreeTypeSettings");
				var nodes = treeObj.getSelectedNodes();
				$('#addProForm').form('submit', {
				    url:'${cxt! }/typeClassSettings/addProduct?typeIds='+nodes[0].id,
				    async : false, 
				    success:function(data){
				    	var  stJson=JSON.parse(data).status; 
				    	var  da=JSON.parse(data).data; 
						if(stJson=="success")
						{	
// 							$("#dlg_addProducy").dialog("close").find('input').val('');
							$("#dlg_addProducy").dialog("close");
							 $.ajax({
								   url: "${cxt !}/typeClassSettings/getProByType",
								   type: "post",
								   async : false, 
								    data:{"ids":da.typeids}, 
								    dataType: "json",
								    success: function (re) {
								        $("#table_typeSettings").datagrid("loadData",re.splitPage.list);  //动态取数据
								    }
							});  
						}
				    }
				});
		}	
			/* function  addPro()
			{
				alert($('#proN').val()+$('#proGroupInfo').val());
				var a=$('#proDiv').text();
				if($('#proGroupInfo').val()!=""  &&  $('#proN').val()!=0){
				a+=$('#proGroupInfo').val()+":"+$('#proN').val()+",";
				$('#proDiv').text(a);
				}
			} */
// 			function  addBody()
// 			{
// 				alert($('#bodyN').val()+$('#bodyUsing').val());
// 				var a=$('#bodyDiv').text();
// 				a+=$('#bodyUsing').val()+":"+$('#bodyN').val()+",";
// 				$('#bodyDiv').text(a);
// 			}
// 			function  addproGrop()
// 			{
// 				//alert("a");
// 				$('#dlg').dialog('close');
// 			}
			
			
		function onClickRow(){
			
			var row = $('#table_typeSettings').datagrid('getSelected');//获取选中行的数据
     		 	if (!row){
       				  return;//为防止意外情况可以选择加上此判断
     			 }
     			 var aid = row.productName;
     			
     			return  aid; 
		}
			
			//字体设置
			function getFont(treeId, node) {
				return node.font ? node.font : {};
			}
			////////////////////下面是处理增删改节点//////////////////

			//节点被删除之前的事件,并且根据返回值确定是否允许删除操作
			function beforeRemove(treeId, treeNode) {
				var zTree = $.fn.zTree.getZTreeObj("zTreeTypeSettings");
				zTree.selectNode(treeNode);

				var result = false;
				if(confirm("确认删除<" + treeNode.name + ">吗？")) {
					var url = "/typeClassSettings/del";
					var data = { "ids": treeNode.id};

					var reData = common_ajax.ajaxFunc(url, data);
					if(reData == "false") {
						alert("删除<" + treeNode.name + ">部门失败！");
					} else {
						result = true;
					}
					result = true;
				}

				return result;
			}

			//用于捕获节点编辑名称
			function beforeRename(treeId, treeNode, newName, isCancel) {
				if(treeNode.name == newName) {
					return true;
				} else if(newName.length == 0) {
					alert("部门名称不能为空！");
					return false;
				} else {
					var url = "/typeClassSettings/update";
					var data = { "ids": treeNode.id,  "pIds":treeNode.id ,"names": newName };

					var reData = common_ajax.ajaxFunc(url, data);
					if(reData == treeNode.id) {
						return true;
					} else {
						alert("修改<" + treeNode.name + ">部门名称失败！");
						return false;
					}
				}
			}

			//添加功能按钮
			var newCount = 1;

			function addHoverDom(treeId, treeNode) {
				var sObj = $("#" + treeNode.tId + "_span");
				if(treeNode.editNameFlag || $("#addBtn_" + treeNode.tId).length > 0) {
					return;
				}

				//1.处理添加按钮
				var addStr = "<span class='button add' id='addBtn_" + treeNode.tId + "' title='添加类别' onfocus='this.blur();'></span>";
				sObj.after(addStr);
				var btn = $("#addBtn_" + treeNode.tId);
				if(btn) btn.bind("click", function() {
					var newId = (newCount++);
					var addName = "新增类别" + newId; //部门初始化名称
					var orderIds = (treeNode.children == undefined ? 1 : (treeNode.children.length + 1));

					var url = "/typeClassSettings/add";
					var data = {
						"pIds": treeNode.id,
						"names": addName,
						//"orderIds": orderIds,
						//"csrfToken": "${csrfToken!}"
						"images":"cog.png"
					};

					var reData = common_ajax.ajaxFunc(url, data);
					if(reData != "") {
						var zTree = $.fn.zTree.getZTreeObj("zTreeTypeSettings");
						zTree.addNodes(treeNode, { id: reData, pId: treeNode.id, name: addName });
// 						var node = zTree.getNodeByParam("id", newId, null); //根据新的id找到新添加的节点  
//            		 		zTree.selectNode(node); //让新添加的节点处于选中状态  
					} else {
						alert("新增类型失败！");
					}

//					return false;
				});

				//2.部门负责人设置按钮
					/*
					var operatorStr = "<span class='button edit' id='operatorBtn_" + treeNode.tId + "' title='添加产品' onfocus='this.blur();'></span>";
					sObj.after(operatorStr);
					var btn = $("#operatorBtn_" + treeNode.tId);
					if(btn) btn.bind("click", function() {
						$("#dlg").dialog("open");
						/*$.fn.zTree.init($("#zTreeStation"), station_setting, station_data);
						return false;
						if(treeNode.id == 111)
						{
							$("#proType").textbox("setValue", "疗程");
						}
						if(treeNode.id == 112)
						{
							$("#proType").textbox("setValue", "瘦身");
						}
						if(treeNode.id == 113)
						{
							$("#proType").textbox("setValue", "紧肤");
						}
					});*/
					
			};

			function removeHoverDom(treeId, treeNode) {
				//1.处理添加按钮
				$("#addBtn_" + treeNode.tId).unbind().remove();
				//2.处理查看按钮
				$("#operatorBtn_" + treeNode.tId).unbind().remove();
			};

			////////////////////下面是处理展开//////////////////

			//用于捕获异步加载之前的事件回调函数,zTree 根据返回值确定是否允许进行异步加载
			function beforeAsync() {
				curAsyncCount++;
			}

			//用于捕获异步加载出现异常错误的事件回调函数
			function onAsyncSuccess(event, treeId, treeNode, msg) {
				curAsyncCount--;
				if(curStatus == "expand") {
					expandNodes(treeNode.children);
				} else if(curStatus == "async") {
					asyncNodes(treeNode.children);
				}

				if(curAsyncCount <= 0) {
					if(curStatus != "init" && curStatus != "") {
						//$("#demoMsg").text((curStatus == "expand") ? "全部展开完毕" : "后台异步加载完毕");
						asyncForAll = true;
					}
					curStatus = "";
				}
			}

			//用于捕获异步加载正常结束的事件回调函数
			function onAsyncError(event, treeId, treeNode, XMLHttpRequest, textStatus, errorThrown) {
				curAsyncCount--;

				if(curAsyncCount <= 0) {
					curStatus = "";
					if(treeNode != null) asyncForAll = true;
				}
			}

			var curStatus = "init",
				curAsyncCount = 0,
				asyncForAll = false,
				goAsync = false;

			function expandAll() {
				if(!check()) {
					return;
				}
				var zTree = $.fn.zTree.getZTreeObj("zTreeTypeSettings");
				if(asyncForAll) {
					//$("#demoMsg").text("已经异步加载完毕，使用 expandAll 方法");
					//zTree.expandAll(true);
					var nodes = zTree.getSelectedNodes();
					if (nodes.length>0) {
							treeObj.expandNode(nodes[0], true, true, true);
					}
				} else {
					expandNodes(zTree.getNodes());
					if(!goAsync) {
						//$("#demoMsg").text("已经异步加载完毕，使用 expandAll 方法");
						curStatus = "";
					}
				}
			}

			function expandNodes(nodes) {
				if(!nodes) {
					return;
				}
				curStatus = "expand";
				var zTree = $.fn.zTree.getZTreeObj("zTreeTypeSettings");
				for(var i = 1, l = nodes.length; i < l; i++) {
					zTree.expandNode(nodes[0], true, true, true);
					zTree.expandNode(nodes[i], true, false, false);
					if(nodes[i].isParent && nodes[i].zAsync) {
						expandNodes(nodes[i].children);
					} else {
						goAsync = true;
					}
				}
			}

			function asyncAll() {
				if(!check()) {
					return;
				}
				var zTree = $.fn.zTree.getZTreeObj("zTreeTypeSettings");
				if(asyncForAll) {
					//$("#demoMsg").text("已经异步加载完毕，不再重新加载");
				} else {
					asyncNodes(zTree.getNodes());
					if(!goAsync) {
						//$("#demoMsg").text("已经异步加载完毕，不再重新加载");
						curStatus = "";
					}
				}
			}

			function asyncNodes(nodes) {
				if(!nodes) {
					return;
				}
				curStatus = "async";
				var zTree = $.fn.zTree.getZTreeObj("zTreeTypeSettings");
				for(var i = 0, l = nodes.length; i < l; i++) {
					if(nodes[i].isParent && nodes[i].zAsync) {
						asyncNodes(nodes[i].children);
					} else {
						goAsync = true;
						zTree.reAsyncChildNodes(nodes[i], "refresh", true);
					}
				}
			}

			function reset() {
				if(!check()) {
					return;
				}
				asyncForAll = false;
				goAsync = false;
				//$("#demoMsg").text("");
				$.fn.zTree.init($("#treeDemo"), setting);
			}

			function check() {
				if(curAsyncCount > 0) {
					//$("#demoMsg").text("正在进行异步加载，请等一会儿再点击...");
					return false;
				}
				return true;
			}

			////////////////////下面是处理拖拽///////////////////

			function dropPrev(treeId, nodes, targetNode) {
				var pNode = targetNode.getParentNode();
				if(pNode && pNode.dropInner === false) {
					return false;
				} else {
					for(var i = 0, l = curDragNodes.length; i < l; i++) {
						var curPNode = curDragNodes[i].getParentNode();
						if(curPNode && curPNode !== targetNode.getParentNode() && curPNode.childOuter === false) {
							return false;
						}
					}
				}
				return true;
			}

			function dropInner(treeId, nodes, targetNode) {
				if(targetNode && targetNode.dropInner === false) {
					return false;
				} else {
					for(var i = 0, l = curDragNodes.length; i < l; i++) {
						if(!targetNode && curDragNodes[i].dropRoot === false) {
							return false;
						} else if(curDragNodes[i].parentTId && curDragNodes[i].getParentNode() !== targetNode && curDragNodes[i].getParentNode().childOuter === false) {
							return false;
						}
					}
				}
				return true;
			}

			function dropNext(treeId, nodes, targetNode) {
				var pNode = targetNode.getParentNode();
				if(pNode && pNode.dropInner === false) {
					return false;
				} else {
					for(var i = 0, l = curDragNodes.length; i < l; i++) {
						var curPNode = curDragNodes[i].getParentNode();
						if(curPNode && curPNode !== targetNode.getParentNode() && curPNode.childOuter === false) {
							return false;
						}
					}
				}
				return true;
			}

			//用于捕获节点被拖拽之前的事件回调函数，并且根据返回值确定是否允许开启拖拽操作
			var log, className = "dark",
				curDragNodes, autoExpandNode;

			function beforeDrag(treeId, treeNodes) {
				className = (className === "dark" ? "" : "dark");
				for(var i = 0, l = treeNodes.length; i < l; i++) {
					if(treeNodes[i].drag === false) {
						curDragNodes = null;
						return false;
					} else if(treeNodes[i].parentTId && treeNodes[i].getParentNode().childDrag === false) {
						curDragNodes = null;
						return false;
					}
				}
				curDragNodes = treeNodes;
				return true;
			}

			//用于捕获拖拽节点移动到折叠状态的父节点后，即将自动展开该父节点之前的事件回调函数，并且根据返回值确定是否允许自动展开操作
			function beforeDragOpen(treeId, treeNode) {
				autoExpandNode = treeNode;
				return true;
			}

			//用于捕获节点拖拽操作结束之前的事件回调函数，并且根据返回值确定是否允许此拖拽操作
			function beforeDrop(treeId, treeNodes, targetNode, moveType, isCopy) {
				className = (className === "dark" ? "" : "dark");
				return true;
			}

			//用于捕获节点被拖拽的事件回调函数
			function onDrag(event, treeId, treeNodes) {
				className = (className === "dark" ? "" : "dark");
			}

			//用于捕获节点拖拽操作结束的事件回调函数
			function onDrop(event, treeId, treeNodes, targetNode, moveType, isCopy) {
				className = (className === "dark" ? "" : "dark");
				//alert(treeNodes.length + ":"+treeNodes[0].id + ", " + (targetNode ? (targetNode.id + ", " + targetNode.name) : "isRoot" ));
				if(treeNodes.length > 0 && targetNode) {
					var dragId = treeNodes[0].id; //被拖拽部门
					var targetId = targetNode.id; //拖拽到的目标部门

					var url = "/platform/dept/update";
					var data = { "ids": dragId, "pIds": targetId, "csrfToken": "${csrfToken!}" };

					var reData = common_ajax.ajaxFunc(url, data);
					if(reData != dragId) {
						common_modals.alert("移动部门失败！");
					}
				}
			}
			var curExpandNode = null;
		function beforeExpand(treeId, treeNode) {
			var pNode = curExpandNode ? curExpandNode.getParentNode():null;
			var treeNodeP = treeNode.parentTId ? treeNode.getParentNode():null;
			var zTree = $.fn.zTree.getZTreeObj("zTreeTypeSettings");
			for(var i=1, l=!treeNodeP ? 0:treeNodeP.children.length; i<l; i++ ) {
				if (treeNode !== treeNodeP.children[i]) {
					
					zTree.expandNode(treeNodeP.children[i], false);
				}
			}
			while (pNode) {
				if (pNode === treeNode) {
					break;
				}
				pNode = pNode.getParentNode();
			}
			if (!pNode) {
				singlePath(treeNode);
			}

		}
		function singlePath(newNode) {
			if (newNode === curExpandNode) return;

            var zTree = $.fn.zTree.getZTreeObj("zTreeTypeSettings"),
                    rootNodes, tmpRoot, tmpTId, i, j, n;

            if (!curExpandNode) {
                tmpRoot = newNode;
                while (tmpRoot) {
                    tmpTId = tmpRoot.tId;
                    tmpRoot = tmpRoot.getParentNode();
                }
                rootNodes = zTree.getNodes();
                for (i=0, j=rootNodes.length; i<j; i++) {
                    n = rootNodes[i];
                    if (n.tId != tmpTId) {
                        zTree.expandNode(n, false);
                    }
                }
            } else if (curExpandNode && curExpandNode.open) {
				if (newNode.parentTId === curExpandNode.parentTId) {
					zTree.expandNode(curExpandNode, false);
				} else {
					var newParents = [];
					while (newNode) {
						newNode = newNode.getParentNode();
						if (newNode === curExpandNode) {
							newParents = null;
							break;
						} else if (newNode) {
							newParents.push(newNode);
						}
					}
					if (newParents!=null) {
						var oldNode = curExpandNode;
						var oldParents = [];
						while (oldNode) {
							oldNode = oldNode.getParentNode();
							if (oldNode) {
								oldParents.push(oldNode);
							}
						}
						if (newParents.length>0) {
							zTree.expandNode(oldParents[Math.abs(oldParents.length-newParents.length)-1], false);
						} else {
							zTree.expandNode(oldParents[oldParents.length-1], false);
						}
					}
				}
			}
			curExpandNode = newNode;
		}

		
		
		
			//用于捕获节点被展开的事件回调函数
			function onExpand(event, treeId, treeNode) {
				curExpandNode = treeNode;
				if(treeNode === autoExpandNode) {
					className = (className === "dark" ? "" : "dark");
				}
			}

			function setTrigger() {
				var zTree = $.fn.zTree.getZTreeObj("zTreeTypeSettings");
				zTree.setting.edit.drag.autoExpandTrigger = $("#callbackTrigger").attr("checked");
			}

			//////////////////初始化////////////////////

			$(document).ready(function() {
				$("#table_div" ).css("display", "none"); 
				$.fn.zTree.init($("#zTreeTypeSettings"), setting);
			
				$("#callbackTrigger").bind("change", {}, setTrigger); //拖拽节点时自动展开父节点是否触发

				//$("#expandAllBtn").bind("click", expandAll);	//全部展开
				//$("#asyncAllBtn").bind("click", asyncAll);	//背后展开
				//$("#resetBtn").bind("click", reset);	//重置
			});
			
			
			function  aa()
			{
				var treeObj = $.fn.zTree.getZTreeObj("zTreeTypeSettings");
				var nodes = treeObj.getNodes();
				if (nodes.length>0) {
// 					treeObj.selectNode(nodes[0]);
					treeObj.expandNode(nodes[0], true);  
				}
			}
			/*var firstAsyncSuccessFlag = 0;
			function zTreeOnAsyncSuccess(event, treeId, msg) {  
				if (firstAsyncSuccessFlag == 0) {  
          		 var zTree = $.fn.zTree.getZTreeObj("zTreeTypeSettings");
                 //调用默认展开第一个结点  
                 var selectedNode = zTree.getSelectedNodes();  
                 var nodes = zTree.getNodes();  
                 zTree.expandNode(nodes[0], true);  
              
                 var childNodes = zTree.transformToArray(nodes[0]);  
                 zTree.expandNode(childNodes[1], true);  
                 
                 var childNodes1 = zTree.transformToArray(childNodes[1]);  
                 zTree.checkNode(childNodes1[1], true, true); 
                 zTree.selectNode(childNodes1[1]); //选中第一个父节点下面第一个子节点
                 zTree.expandNode(childNodes1[1], true);
                 zTree.setting.callback.onClick(null, zTree.setting.treeId, childNodes1[1]);//点击第一个父节点下面第一个子节点
                 var childNodes2 = zTree.transformToArray(childNodes1[1]);
                 zTree.setChkDisabled(childNodes2[1], true, true);
                 zTree.checkNode(childNodes2[1], true, true); 
               
                 firstAsyncSuccessFlag = 1;  
              
     }  
}*/
			setTimeout(function() {
				aa();
				
			}, 500);
		</script>

